// 所有用户标签

import { userTagList } from "@/request/user"
import { useEffect, useState } from "react"

export default function useApplication () {
    const [ options, setOptions ] = useState<Array<Record<string,unknown>>>([])
    const getData = async () => {
        const { code, data } = await userTagList({page: 1, limit: 1000} as any)
        if ( code === 200 ) {
            setOptions(data?.list?.map((item: { tagDesc: any; tagCode: any }) => {
                return {
                    ...item,
                    label: item.tagDesc,
                    value: item.tagCode,
                    key:item.tagCode,
                }
            }))
        } else {
            setOptions( [] )
        }
    }
    useEffect( () => {
        getData()
    }, [] )
    return options
}